package com.tbit.uqbike.client.service.impl;

import com.tbit.uqbike.client.dao.core.UserDelayPayDao;
import com.tbit.uqbike.client.pojo.newEntity.UserDelayPay;
import com.tbit.uqbike.client.service.UserDelayPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @Author: chen
 * @Description: 延时分账信息
 * @Date: 创建于 16:28 2022/4/20
 */
@Service
public class UserDelayPayServiceImpl implements UserDelayPayService {

    @Autowired
    private UserDelayPayDao userDelayPayDao;

    @Override
    public List<UserDelayPay> getAll() {
        return userDelayPayDao.getAll();
    }

    @Override
    public void del(String orderNO) {
        userDelayPayDao.del(orderNO);
    }

    @Override
    public void add(UserDelayPay userDelayPay) {
        UserDelayPay userDelayPayDB = userDelayPayDao.getByOrderNO(userDelayPay.getOrderNO());
        if (userDelayPayDB != null) {
            return;
        }
        userDelayPay.setAddTime(new Date());
        userDelayPayDao.add(userDelayPay);
    }
}
